#include "head.h"

int sockfd;
char buf[1024];

int main(int argc, char *argv[]) {
    sockfd = socket_create(8080);

    while (true) {
        int new_fd; 
        struct sockaddr_in client; 
        socklen_t len = sizeof(client); 

        if ((new_fd = accept(sockfd, (struct sockaddr *)&client, &len)) < 0) {
            perror("accept");
            exit(1);
        }

        printf("<Accept> %s: %d: accept a client!\n", inet_ntoa(client.sin_addr), ntohs(client.sin_port));

    }

    close(sockfd);
    return 0;
}